package com.atguigu.eduservice.controller.front;

import com.atguigu.commonutils.R;
import com.atguigu.eduservice.controller.TeacherController;
import com.atguigu.eduservice.entity.EduCourse;
import com.atguigu.eduservice.entity.EduTeacher;
import com.atguigu.eduservice.service.CourseService;
import com.atguigu.eduservice.service.TeacherService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @create: 2022/10/6
 * @Description:
 * @FileName: IndexFrontController
 * @自定义内容：
 */
@RestController
@RequestMapping("/eduservice/indexFront")
public class IndexFrontController {


    @Autowired
    private CourseService courseService;

    @Autowired
    private TeacherService teacherService;


    //查询前8条热门课程，查询前4条名师
    @GetMapping("getPopular")
    public R getPopular(){

        List<EduCourse> eduCourses = courseService.getHotCourse();


        List<EduTeacher> eduTeachers = teacherService.selectHotTeacher();
        return R.ok().data("eduCourses",eduCourses).data("eduTeachers",eduTeachers);
    }
}
